#include <retro.h>
#include "retro.creator.h"

#define ABOUT_COPYRIGHT \
  _T("Copyright (c) Volatile Bytes 2012\n") ## \
  _T("Copyright (c) Vincent Tremblay 2012")

using namespace Retro::Creator::Dialog;
using namespace SPLib::Windows;

VOID About::onNotify(Event::NotifyEvent& iEvent)
{
  switch (iEvent.data->idFrom)
  {
  case IDCANCEL:
  case IDOK:
    hide();
    break;
  }
}

VOID    About::onLoad()
{
  TCHAR mLogoFilename[MAX_PATH];

  GetModuleFileName(getInstance(), mLogoFilename, MAX_PATH);
  PathRemoveFileSpec(mLogoFilename);
  _tcscat(mLogoFilename, _T("\\res\\logo.png"));

  LayoutElement* mContent = getLayout().addTop(128);

  mProduct.create(*this, _T("Retro Game Creator"));
  mProduct.setFont(new Gdip::Font(_T("Arial"), 16, Gdip::FontStyleBold));
  mProduct.setForeColor(0xFF333333);

  mCopyright.create(*this, ABOUT_COPYRIGHT);
  mCopyright.setFont(getGdipFont());

  mLogo.create(*this);
  mLogo.setImage(new Gdip::Bitmap(mLogoFilename));
  mLogo.setSizeMode(Geom::ImageSizeModeFill);

  mContent->addLeft(128, mLogo);
  mContent->addTop(25);
  mContent->addTop(23, mProduct);
  mContent->addFill(mCopyright);

  addOK(mOK, mSeparator);
}

VOID    About::onUnload()
{
}
